#include "../userprog/syscall.h"

void main(){

char* execName;
int nameLen;

int latestIndex;
int latestIndexCondition;
int latestIndexLock;
int NUM_TICKET_CLERKS;


latestIndex = CreateMV(1, "latestIndex", 11);
latestIndexCondition = CreateCondition("latestIndexCondition", 20);
latestIndexLock = CreateLock("latestIndexLock",15);
NUM_TICKET_CLERKS = CreateMV(1,"NUM_TICKET_CLERKS",17);

for(SetMV(latestIndex,0,0); GetMV(latestIndex,0) < GetMV(NUM_TICKET_CLERKS,0); SetMV(latestIndex,0,GetMV(latestIndex,0) + 1))
{
	AcquireLock(latestIndexLock);

	execName = "../test/ticketclerk";
	nameLen = 19;
	Exec(execName, nameLen);
	WaitCondition(latestIndexCondition, latestIndexLock);
	ReleaseLock(latestIndexLock);
}


}